#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>

using namespace std;

map<string,int> mp={
    {"January",1},
    {"February",2},
    {"March",3},
    {"April",4},
    {"May",5},
    {"June",6},
    {"July",7},
    {"August",8},
    {"September",9},
    {"October",10},
    {"November",11},
    {"December",12}
};

int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
char week[10][10]={
    "Sunday",
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday" 
};

bool is_year(int x)
{
    if(x % 400 == 0) return true;
    if(x % 4 == 0 && x % 100 != 0) return true;
    return false;
}

int main()
{
    int d,y;
    string m;
    while(cin>>d>>m>>y)
    {
        int day=0;
        for(int i=1;i<y;i++)
        {
            if(is_year(i)) day+=366;
            else day+=365;
        }
        
        for(int i=1;i<mp[m];i++)
        {
            if(i == 2 && is_year(y))
            {
                day+=29;
            }
            else day+=month[i];
        }
        day+=d;
        //cout<<day<<'\n';
        cout<<week[day%7]<<'\n';
    }
    return 0;
}

